package com.cheney.common.sensitive.strategy;

/**
 * 简单的脱敏策略
 */
public enum SimpleSensitiveStrategy implements SensitiveStrategy {

    /**
     * 姓名类脱敏策略
     */
    NAME("name", 1, 1, '*'),

    /**
     * 账号类脱敏策略
     */
    ACCOUNT_NO("accountNo", 2, 2, '*'),

    /**
     * 邮箱类脱敏策略
     */
    EMAIL("email", 2, 7, '*'),

    /**
     * 身份证号类脱敏策略
     */
    ID_CARD("idCard", 6, 4, '*'),

    /**
     * 手机号码类脱敏策略
     */
    PHONE_NUMBER("phoneNumber", 3, 4, '*'),

    /**
     * 住址类脱敏策略
     */
    ADDRESS("address", 3, 4, '*');

    private final String category;

    private final int retainPrefixCount;

    private final int retainSuffixCount;

    private final char replaceChar;

    SimpleSensitiveStrategy(String category, int retainPrefixCount, int retainSuffixCount, char replaceChar) {
        this.category = category;
        this.retainPrefixCount = retainPrefixCount;
        this.retainSuffixCount = retainSuffixCount;
        this.replaceChar = replaceChar;
    }

    @Override
    public String category() {
        return this.category;
    }

    @Override
    public int retainPrefixCount() {
        return this.retainPrefixCount;
    }

    @Override
    public int retainSuffixCount() {
        return this.retainSuffixCount;
    }

    @Override
    public char replaceChar() {
        return this.replaceChar;
    }
}
